package com.mijie.homi.dao.mood;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.mijie.core.IBatisDao;
import com.mijie.homi.common.domain.mood.MoodInfo;

@Repository
public class MoodInfoDao extends IBatisDao{

	public int[] getMateOfMood(int mood){
		String mate = this.selectStr("getMateOfMood", mood);
		if(mate==null || mate.trim().isEmpty()) return null;
		String[] term = mate.split(" ");
		int[] result = new int[term.length];
		int index = 0;
		for(String m : term){
			if(m.trim().isEmpty()) continue;
			result[index++] = Integer.parseInt(m); 
		}
		return result;
	}
	
	public List<MoodInfo> listMoodInfo(){
		return this.selectList("listMoodInfo");
	}
	
	public String getMoodNameById(int id){
		return this.selectStr("getMoodNameById", id);
	}
}
